package demo;

import java.util.Scanner;
import java.util.Stack;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
           String input = in.nextLine();
           String result = remove(input);
           if (result.isEmpty()){
               System.out.println(0);
           } else {
               System.out.println(result);
           }
    }

    private static String remove(String s){
        Stack<Character> stack = new Stack<>();
        for (char ch : s.toCharArray()){
            if (!stack.isEmpty() && stack.peek() == ch){
                stack.pop();
            } else {
                stack.push(ch);
            }
        }
        StringBuilder stringBuilder = new StringBuilder();
        for(char c : stack){
            stringBuilder.append(c);
        }
        return stringBuilder.toString();

    }

}